
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>结构 · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Do's and Don'ts.html" />
    
    
    <link rel="prev" href="Introduction.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../tutorials/">
            
                <a href="../tutorials/">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../tutorials/TypeScript in 5 minutes.html">
            
                <a href="../tutorials/TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../tutorials/ASP.NET Core.html">
            
                <a href="../tutorials/ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../tutorials/ASP.NET 4.html">
            
                <a href="../tutorials/ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../tutorials/Gulp.html">
            
                <a href="../tutorials/Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../tutorials/Knockout.html">
            
                <a href="../tutorials/Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../tutorials/React & Webpack.html">
            
                <a href="../tutorials/React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../tutorials/React.html">
            
                <a href="../tutorials/React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../tutorials/Angular 2.html">
            
                <a href="../tutorials/Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../tutorials/Migrating from JavaScript.html">
            
                <a href="../tutorials/Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../">
            
                <a href="../">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Basic Types.html">
            
                <a href="../Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Variable Declarations.html">
            
                <a href="../Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Interfaces.html">
            
                <a href="../Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Classes.html">
            
                <a href="../Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Functions.html">
            
                <a href="../Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../Generics.html">
            
                <a href="../Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../Enums.html">
            
                <a href="../Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Type Inference.html">
            
                <a href="../Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../Type Compatibility.html">
            
                <a href="../Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Advanced Types.html">
            
                <a href="../Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Symbols.html">
            
                <a href="../Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Iterators and Generators.html">
            
                <a href="../Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="../Modules.html">
            
                <a href="../Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="../Namespaces.html">
            
                <a href="../Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="../Namespaces and Modules.html">
            
                <a href="../Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="../Module Resolution.html">
            
                <a href="../Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="../Declaration Merging.html">
            
                <a href="../Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="../Writing Definition Files.html">
            
                <a href="../Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="../JSX.html">
            
                <a href="../JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="../Decorators.html">
            
                <a href="../Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="../Mixins.html">
            
                <a href="../Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="../Triple-Slash Directives.html">
            
                <a href="../Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="../Type Checking JavaScript Files.html">
            
                <a href="../Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Introduction.html">
            
                <a href="Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.1" data-path="Library Structures.html">
            
                <a href="Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="Do's and Don'ts.html">
            
                <a href="Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="By Example.html">
            
                <a href="By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="Deep Dive.html">
            
                <a href="Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="Publishing.html">
            
                <a href="Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="Consumption.html">
            
                <a href="Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../tsconfig.json.html">
            
                <a href="../tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../tsconfig.json.html">
            
                <a href="../tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Project References.html">
            
                <a href="../Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Typings for NPM Packages.html">
            
                <a href="../Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Compiler Options.html">
            
                <a href="../Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Configuring Watch.html">
            
                <a href="../Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../Compiler Options in MSBuild.html">
            
                <a href="../Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../Integrating with Build Tools.html">
            
                <a href="../Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../Nightly Builds.html">
            
                <a href="../Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../wiki/">
            
                <a href="../../wiki/">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../wiki/this-in-TypeScript.html">
            
                <a href="../../wiki/this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../wiki/coding_guidelines.html">
            
                <a href="../../wiki/coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../wiki/Common Errors.html">
            
                <a href="../../wiki/Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../wiki/TypeScript-Editor-Support.html">
            
                <a href="../../wiki/TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="../../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../wiki/Architectural-Overview.html">
            
                <a href="../../wiki/Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../wiki/Roadmap.html">
            
                <a href="../../wiki/Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../release-notes/">
            
                <a href="../../release-notes/">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../release-notes/TypeScript 3.1.html">
            
                <a href="../../release-notes/TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../release-notes/TypeScript 3.0.html">
            
                <a href="../../release-notes/TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../release-notes/TypeScript 2.9.html">
            
                <a href="../../release-notes/TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../release-notes/TypeScript 2.8.html">
            
                <a href="../../release-notes/TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../release-notes/TypeScript 2.7.html">
            
                <a href="../../release-notes/TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../../release-notes/TypeScript 2.6.html">
            
                <a href="../../release-notes/TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../../release-notes/TypeScript 2.5.html">
            
                <a href="../../release-notes/TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../../release-notes/TypeScript 2.4.html">
            
                <a href="../../release-notes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../../release-notes/TypeScript 2.3.html">
            
                <a href="../../release-notes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../../release-notes/TypeScript 2.2.html">
            
                <a href="../../release-notes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="../../release-notes/TypeScript 2.1.html">
            
                <a href="../../release-notes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="../../release-notes/TypeScript 2.0.html">
            
                <a href="../../release-notes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="../../release-notes/TypeScript 1.8.html">
            
                <a href="../../release-notes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="../../release-notes/TypeScript 1.7.html">
            
                <a href="../../release-notes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="../../release-notes/TypeScript 1.6.html">
            
                <a href="../../release-notes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="../../release-notes/TypeScript 1.5.html">
            
                <a href="../../release-notes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="../../release-notes/TypeScript 1.4.html">
            
                <a href="../../release-notes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="../../release-notes/TypeScript 1.3.html">
            
                <a href="../../release-notes/TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="../../release-notes/TypeScript 1.1.html">
            
                <a href="../../release-notes/TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../breaking-changes/breaking-changes.html">
            
                <a href="../../breaking-changes/breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../breaking-changes/TypeScript 2.4.html">
            
                <a href="../../breaking-changes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../breaking-changes/TypeScript 2.3.html">
            
                <a href="../../breaking-changes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../../breaking-changes/TypeScript 2.2.html">
            
                <a href="../../breaking-changes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../../breaking-changes/TypeScript 2.1.html">
            
                <a href="../../breaking-changes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../../breaking-changes/TypeScript 2.0.html">
            
                <a href="../../breaking-changes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../../breaking-changes/TypeScript 1.8.html">
            
                <a href="../../breaking-changes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../../breaking-changes/TypeScript 1.7.html">
            
                <a href="../../breaking-changes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../../breaking-changes/TypeScript 1.6.html">
            
                <a href="../../breaking-changes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../../breaking-changes/TypeScript 1.5.html">
            
                <a href="../../breaking-changes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="../../breaking-changes/TypeScript 1.4.html">
            
                <a href="../../breaking-changes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >结构</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6982;&#x8FF0;">&#x6982;&#x8FF0;</h1>
<p>&#x4E00;&#x822C;&#x6765;&#x8BB2;&#xFF0C;&#x4F60;<em>&#x7EC4;&#x7EC7;</em>&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#x53D6;&#x51B3;&#x4E8E;&#x5E93;&#x662F;&#x5982;&#x4F55;&#x88AB;&#x4F7F;&#x7528;&#x7684;&#x3002;
&#x5728;JavaScript&#x4E2D;&#x4E00;&#x4E2A;&#x5E93;&#x6709;&#x5F88;&#x591A;&#x4F7F;&#x7528;&#x65B9;&#x5F0F;&#xFF0C;&#x8FD9;&#x5C31;&#x9700;&#x8981;&#x4F60;&#x4E66;&#x5199;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x53BB;&#x5339;&#x914D;&#x5B83;&#x4EEC;&#x3002;
&#x8FD9;&#x7BC7;&#x6307;&#x5357;&#x6DB5;&#x76D6;&#x4E86;&#x5982;&#x4F55;&#x8BC6;&#x522B;&#x5E38;&#x89C1;&#x5E93;&#x7684;&#x6A21;&#x5F0F;&#xFF0C;&#x548C;&#x600E;&#x6837;&#x4E66;&#x5199;&#x7B26;&#x5408;&#x76F8;&#x5E94;&#x6A21;&#x5F0F;&#x7684;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x9488;&#x5BF9;&#x6BCF;&#x79CD;&#x4E3B;&#x8981;&#x7684;&#x5E93;&#x7684;&#x7EC4;&#x7EC7;&#x6A21;&#x5F0F;&#xFF0C;&#x5728;<a href="Templates.md">&#x6A21;&#x7248;</a>&#x4E00;&#x8282;&#x90FD;&#x6709;&#x5BF9;&#x5E94;&#x7684;&#x6587;&#x4EF6;&#x3002;
&#x4F60;&#x53EF;&#x4EE5;&#x5229;&#x7528;&#x5B83;&#x4EEC;&#x5E2E;&#x52A9;&#x4F60;&#x5FEB;&#x901F;&#x4E0A;&#x624B;&#x3002;</p>
<h1 id="&#x8BC6;&#x522B;&#x5E93;&#x7684;&#x7C7B;&#x578B;">&#x8BC6;&#x522B;&#x5E93;&#x7684;&#x7C7B;&#x578B;</h1>
<p>&#x9996;&#x5148;&#xFF0C;&#x6211;&#x4EEC;&#x5148;&#x770B;&#x4E00;&#x4E0B;TypeScript&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x80FD;&#x591F;&#x8868;&#x793A;&#x7684;&#x5E93;&#x7684;&#x7C7B;&#x578B;&#x3002;
&#x8FD9;&#x91CC;&#x4F1A;&#x7B80;&#x5355;&#x5C55;&#x793A;&#x6BCF;&#x79CD;&#x7C7B;&#x578B;&#x7684;&#x5E93;&#x7684;&#x4F7F;&#x7528;&#x65B9;&#x5F0F;&#xFF0C;&#x5982;&#x4F55;&#x53BB;&#x4E66;&#x5199;&#xFF0C;&#x8FD8;&#x6709;&#x4E00;&#x4E9B;&#x771F;&#x5B9E;&#x6848;&#x4F8B;&#x3002;</p>
<p>&#x8BC6;&#x522B;&#x5E93;&#x7684;&#x7C7B;&#x578B;&#x662F;&#x4E66;&#x5199;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x7684;&#x7B2C;&#x4E00;&#x6B65;&#x3002;
&#x6211;&#x4EEC;&#x5C06;&#x4F1A;&#x7ED9;&#x51FA;&#x4E00;&#x4E9B;&#x63D0;&#x793A;&#xFF0C;&#x5173;&#x4E8E;&#x600E;&#x6837;&#x901A;&#x8FC7;&#x5E93;&#x7684;<em>&#x4F7F;&#x7528;&#x65B9;&#x6CD5;</em>&#x53CA;&#x5176;<em>&#x6E90;&#x7801;</em>&#x6765;&#x8BC6;&#x522B;&#x5E93;&#x7684;&#x7C7B;&#x578B;&#x3002;
&#x6839;&#x636E;&#x5E93;&#x7684;&#x6587;&#x6863;&#x53CA;&#x7EC4;&#x7EC7;&#x7ED3;&#x6784;&#x4E0D;&#x540C;&#xFF0C;&#x8FD9;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#x53EF;&#x80FD;&#x4E00;&#x4E2A;&#x4F1A;&#x6BD4;&#x53E6;&#x5916;&#x7684;&#x90A3;&#x4E2A;&#x7B80;&#x5355;&#x4E00;&#x4E9B;&#x3002;
&#x6211;&#x4EEC;&#x63A8;&#x8350;&#x4F60;&#x4F7F;&#x7528;&#x4EFB;&#x610F;&#x4F60;&#x559C;&#x6B22;&#x7684;&#x65B9;&#x5F0F;&#x3002;</p>
<h2 id="&#x5168;&#x5C40;&#x5E93;">&#x5168;&#x5C40;&#x5E93;</h2>
<p><em>&#x5168;&#x5C40;</em>&#x5E93;&#x662F;&#x6307;&#x80FD;&#x5728;&#x5168;&#x5C40;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x4E0B;&#x8BBF;&#x95EE;&#x7684;&#xFF08;&#x4F8B;&#x5982;&#xFF1A;&#x4E0D;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x4EFB;&#x4F55;&#x5F62;&#x5F0F;&#x7684;<code>import</code>&#xFF09;&#x3002;
&#x8BB8;&#x591A;&#x5E93;&#x90FD;&#x662F;&#x7B80;&#x5355;&#x7684;&#x66B4;&#x9732;&#x51FA;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528;&#x8FC7;<a href="https://jquery.com/" target="_blank">jQuery</a>&#xFF0C;<code>$</code>&#x53D8;&#x91CF;&#x53EF;&#x4EE5;&#x88AB;&#x591F;&#x7B80;&#x5355;&#x7684;&#x5F15;&#x7528;&#xFF1A;</p>
<pre><code class="lang-ts">$(() =&gt; { <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&apos;hello!&apos;</span>); } );
</code></pre>
<p>&#x4F60;&#x7ECF;&#x5E38;&#x4F1A;&#x5728;&#x5168;&#x5C40;&#x5E93;&#x7684;&#x6307;&#x5357;&#x6587;&#x6863;&#x4E0A;&#x770B;&#x5230;&#x5982;&#x4F55;&#x5728;HTML&#x91CC;&#x7528;&#x811A;&#x672C;&#x6807;&#x7B7E;&#x5F15;&#x7528;&#x5E93;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;http://a.great.cdn.for/someLib.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<p>&#x76EE;&#x524D;&#xFF0C;&#x5927;&#x591A;&#x6570;&#x6D41;&#x884C;&#x7684;&#x5168;&#x5C40;&#x8BBF;&#x95EE;&#x578B;&#x5E93;&#x5B9E;&#x9645;&#x4E0A;&#x90FD;&#x4EE5;UMD&#x5E93;&#x7684;&#x5F62;&#x5F0F;&#x8FDB;&#x884C;&#x4E66;&#x5199;&#xFF08;&#x89C1;&#x540E;&#x6587;&#xFF09;&#x3002;
UMD&#x5E93;&#x7684;&#x6587;&#x6863;&#x5F88;&#x96BE;&#x4E0E;&#x5168;&#x5C40;&#x5E93;&#x6587;&#x6863;&#x4E24;&#x8005;&#x4E4B;&#x95F4;&#x96BE;&#x4EE5;&#x533A;&#x5206;&#x3002;
&#x5728;&#x4E66;&#x5199;&#x5168;&#x5C40;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x524D;&#xFF0C;&#x4E00;&#x5B9A;&#x8981;&#x786E;&#x8BA4;&#x4E00;&#x4E0B;&#x5E93;&#x662F;&#x5426;&#x771F;&#x7684;&#x4E0D;&#x662F;UMD&#x3002;</p>
<h3 id="&#x4ECE;&#x4EE3;&#x7801;&#x4E0A;&#x8BC6;&#x522B;&#x5168;&#x5C40;&#x5E93;">&#x4ECE;&#x4EE3;&#x7801;&#x4E0A;&#x8BC6;&#x522B;&#x5168;&#x5C40;&#x5E93;</h3>
<p>&#x5168;&#x5C40;&#x5E93;&#x7684;&#x4EE3;&#x7801;&#x901A;&#x5E38;&#x90FD;&#x5341;&#x5206;&#x7B80;&#x5355;&#x3002;
&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x7684;&#x201C;Hello, world&#x201D;&#x5E93;&#x53EF;&#x80FD;&#x662F;&#x8FD9;&#x6837;&#x7684;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">createGreeting</span>(<span class="hljs-params">s</span>) </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Hello, &quot;</span> + s;
}
</code></pre>
<p>&#x6216;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-built_in">window</span>.createGreeting = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">s</span>) </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Hello, &quot;</span> + s;
}
</code></pre>
<p>&#x5F53;&#x4F60;&#x67E5;&#x770B;&#x5168;&#x5C40;&#x5E93;&#x7684;&#x6E90;&#x4EE3;&#x7801;&#x65F6;&#xFF0C;&#x4F60;&#x901A;&#x5E38;&#x4F1A;&#x770B;&#x5230;&#xFF1A;</p>
<ul>
<li>&#x9876;&#x7EA7;&#x7684;<code>var</code>&#x8BED;&#x53E5;&#x6216;<code>function</code>&#x58F0;&#x660E;</li>
<li>&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x8D4B;&#x503C;&#x8BED;&#x53E5;&#x5230;<code>window.someName</code></li>
<li>&#x5047;&#x8BBE;DOM&#x539F;&#x59CB;&#x503C;&#x50CF;<code>document</code>&#x6216;<code>window</code>&#x662F;&#x5B58;&#x5728;&#x7684;</li>
</ul>
<p>&#x4F60;<em>&#x4E0D;&#x4F1A;</em>&#x770B;&#x5230;&#xFF1A;</p>
<ul>
<li>&#x68C0;&#x67E5;&#x662F;&#x5426;&#x4F7F;&#x7528;&#x6216;&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#xFF0C;&#x6BD4;&#x5982;<code>require</code>&#x6216;<code>define</code></li>
<li>CommonJS/Node.js&#x98CE;&#x683C;&#x7684;&#x5BFC;&#x5165;&#x5982;<code>var fs = require(&quot;fs&quot;);</code></li>
<li><code>define(...)</code>&#x8C03;&#x7528;</li>
<li>&#x6587;&#x6863;&#x91CC;&#x8BF4;&#x660E;&#x4E86;&#x5982;&#x4F55;&#x53BB;<code>require</code>&#x6216;&#x5BFC;&#x5165;&#x8FD9;&#x4E2A;&#x5E93;</li>
</ul>
<h3 id="&#x5168;&#x5C40;&#x5E93;&#x7684;&#x4F8B;&#x5B50;">&#x5168;&#x5C40;&#x5E93;&#x7684;&#x4F8B;&#x5B50;</h3>
<p>&#x7531;&#x4E8E;&#x628A;&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x5E93;&#x8F6C;&#x53D8;&#x6210;UMD&#x5E93;&#x662F;&#x975E;&#x5E38;&#x5BB9;&#x6613;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x5F88;&#x5C11;&#x6D41;&#x884C;&#x7684;&#x5E93;&#x8FD8;&#x518D;&#x4F7F;&#x7528;&#x5168;&#x5C40;&#x7684;&#x98CE;&#x683C;&#x3002;
&#x7136;&#x800C;&#xFF0C;&#x5C0F;&#x578B;&#x7684;&#x4E14;&#x9700;&#x8981;DOM&#xFF08;&#x6216;<em>&#x6CA1;&#x6709;</em>&#x4F9D;&#x8D56;&#xFF09;&#x7684;&#x5E93;&#x53EF;&#x80FD;&#x8FD8;&#x662F;&#x5168;&#x5C40;&#x7C7B;&#x578B;&#x7684;&#x3002;</p>
<h3 id="&#x5168;&#x5C40;&#x5E93;&#x6A21;&#x7248;">&#x5168;&#x5C40;&#x5E93;&#x6A21;&#x7248;</h3>
<p>&#x6A21;&#x7248;&#x6587;&#x4EF6;<a href="templates/global.d.ts.md"><code>global.d.ts</code></a>&#x5B9A;&#x4E49;&#x4E86;<code>myLib</code>&#x5E93;&#x4F5C;&#x4E3A;&#x4F8B;&#x5B50;&#x3002;
&#x4E00;&#x5B9A;&#x8981;&#x9605;&#x8BFB;<a href="#preventing-name-conflicts">&quot;&#x9632;&#x6B62;&#x547D;&#x540D;&#x51B2;&#x7A81;&quot;&#x8865;&#x5145;&#x8BF4;&#x660E;</a>&#x3002;</p>
<h2 id="&#x6A21;&#x5757;&#x5316;&#x5E93;">&#x6A21;&#x5757;&#x5316;&#x5E93;</h2>
<p>&#x4E00;&#x4E9B;&#x5E93;&#x53EA;&#x80FD;&#x5DE5;&#x4F5C;&#x5728;&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#x7684;&#x73AF;&#x5883;&#x4E0B;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x50CF;<code>express</code>&#x53EA;&#x80FD;&#x5728;Node.js&#x91CC;&#x5DE5;&#x4F5C;&#x6240;&#x4EE5;&#x5FC5;&#x987B;&#x4F7F;&#x7528;CommonJS&#x7684;<code>require</code>&#x51FD;&#x6570;&#x52A0;&#x8F7D;&#x3002;</p>
<p>ECMAScript 2015&#xFF08;&#x4E5F;&#x5C31;&#x662F;ES2015&#xFF0C;ECMAScript 6&#x6216;ES6&#xFF09;&#xFF0C;CommonJS&#x548C;RequireJS&#x5177;&#x6709;&#x76F8;&#x4F3C;&#x7684;<em>&#x5BFC;&#x5165;</em>&#x4E00;&#x4E2A;<em>&#x6A21;&#x5757;</em>&#x7684;&#x8868;&#x793A;&#x65B9;&#x6CD5;&#x3002;
&#x4F8B;&#x5982;&#xFF0C;&#x5BF9;&#x4E8E;JavaScript CommonJS &#xFF08;Node.js&#xFF09;&#xFF0C;&#x6709;&#x4E0B;&#x9762;&#x7684;&#x4EE3;&#x7801;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;fs&quot;</span>);
</code></pre>
<p>&#x5BF9;&#x4E8E;TypeScript&#x6216;ES6&#xFF0C;<code>import</code>&#x5173;&#x952E;&#x5B57;&#x4E5F;&#x5177;&#x6709;&#x76F8;&#x540C;&#x7684;&#x4F5C;&#x7528;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> fs = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;fs&quot;</span>);
</code></pre>
<p>&#x4F60;&#x901A;&#x5E38;&#x4F1A;&#x5728;&#x6A21;&#x5757;&#x5316;&#x5E93;&#x7684;&#x6587;&#x6863;&#x91CC;&#x770B;&#x5230;&#x5982;&#x4E0B;&#x8BF4;&#x660E;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> someLib = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;someLib&apos;</span>);
</code></pre>
<p>&#x6216;</p>
<pre><code class="lang-ts">define(..., [<span class="hljs-string">&apos;someLib&apos;</span>], <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">someLib</span>) </span>{

});
</code></pre>
<p>&#x4E0E;&#x5168;&#x5C40;&#x6A21;&#x5757;&#x4E00;&#x6837;&#xFF0C;&#x4F60;&#x4E5F;&#x53EF;&#x80FD;&#x4F1A;&#x5728;UMD&#x6A21;&#x5757;&#x7684;&#x6587;&#x6863;&#x91CC;&#x770B;&#x5230;&#x8FD9;&#x4E9B;&#x4F8B;&#x5B50;&#xFF0C;&#x56E0;&#x6B64;&#x8981;&#x4ED4;&#x7EC6;&#x67E5;&#x770B;&#x6E90;&#x7801;&#x548C;&#x6587;&#x6863;&#x3002;</p>
<h3 id="&#x4ECE;&#x4EE3;&#x7801;&#x4E0A;&#x8BC6;&#x522B;&#x6A21;&#x5757;&#x5316;&#x5E93;">&#x4ECE;&#x4EE3;&#x7801;&#x4E0A;&#x8BC6;&#x522B;&#x6A21;&#x5757;&#x5316;&#x5E93;</h3>
<p>&#x6A21;&#x5757;&#x5E93;&#x81F3;&#x5C11;&#x4F1A;&#x5305;&#x542B;&#x4E0B;&#x5217;&#x5177;&#x6709;&#x4EE3;&#x8868;&#x6027;&#x7684;&#x6761;&#x76EE;&#x4E4B;&#x4E00;&#xFF1A;</p>
<ul>
<li>&#x65E0;&#x6761;&#x4EF6;&#x7684;&#x8C03;&#x7528;<code>require</code>&#x6216;<code>define</code></li>
<li>&#x50CF;<code>import * as a from &apos;b&apos;;</code> or <code>export c;</code>&#x8FD9;&#x6837;&#x7684;&#x58F0;&#x660E;</li>
<li>&#x8D4B;&#x503C;&#x7ED9;<code>exports</code>&#x6216;<code>module.exports</code></li>
</ul>
<p>&#x5B83;&#x4EEC;&#x6781;&#x5C11;&#x5305;&#x542B;&#xFF1A;</p>
<ul>
<li>&#x5BF9;<code>window</code>&#x6216;<code>global</code>&#x7684;&#x8D4B;&#x503C;</li>
</ul>
<h3 id="&#x6A21;&#x5757;&#x5316;&#x5E93;&#x7684;&#x4F8B;&#x5B50;">&#x6A21;&#x5757;&#x5316;&#x5E93;&#x7684;&#x4F8B;&#x5B50;</h3>
<p>&#x8BB8;&#x591A;&#x6D41;&#x884C;&#x7684;Node.js&#x5E93;&#x90FD;&#x662F;&#x8FD9;&#x79CD;&#x6A21;&#x5757;&#x5316;&#x7684;&#xFF0C;&#x4F8B;&#x5982;<a href="http://expressjs.com/" target="_blank"><code>express</code></a>&#xFF0C;<a href="http://gulpjs.com/" target="_blank"><code>gulp</code></a>&#x548C;<a href="https://github.com/request/request" target="_blank"><code>request</code></a>&#x3002;</p>
<h2 id="umd"><em>UMD</em></h2>
<p><em>UMD</em>&#x6A21;&#x5757;&#x662F;&#x6307;&#x90A3;&#x4E9B;&#x65E2;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x6A21;&#x5757;&#x4F7F;&#x7528;&#xFF08;&#x901A;&#x8FC7;&#x5BFC;&#x5165;&#xFF09;&#x53C8;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x5168;&#x5C40;&#xFF08;&#x5728;&#x6CA1;&#x6709;&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#x7684;&#x73AF;&#x5883;&#x91CC;&#xFF09;&#x4F7F;&#x7528;&#x7684;&#x6A21;&#x5757;&#x3002;
&#x8BB8;&#x591A;&#x6D41;&#x884C;&#x7684;&#x5E93;&#xFF0C;&#x6BD4;&#x5982;<a href="http://momentjs.com/" target="_blank">Moment.js</a>&#xFF0C;&#x5C31;&#x662F;&#x8FD9;&#x6837;&#x7684;&#x5F62;&#x5F0F;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x5728;Node.js&#x6216;RequireJS&#x91CC;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x5199;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> moment = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;moment&quot;</span>);
<span class="hljs-built_in">console</span>.log(moment.format());
</code></pre>
<p>&#x7136;&#x800C;&#x5728;&#x7EAF;&#x51C0;&#x7684;&#x6D4F;&#x89C8;&#x5668;&#x73AF;&#x5883;&#x91CC;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x5199;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-built_in">console</span>.log(moment.format());
</code></pre>
<h3 id="&#x8BC6;&#x522B;umd&#x5E93;">&#x8BC6;&#x522B;UMD&#x5E93;</h3>
<p><a href="https://github.com/umdjs/umd" target="_blank">UMD&#x6A21;&#x5757;</a>&#x4F1A;&#x68C0;&#x67E5;&#x662F;&#x5426;&#x5B58;&#x5728;&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#x73AF;&#x5883;&#x3002;
&#x8FD9;&#x662F;&#x975E;&#x5E38;&#x5F62;&#x5BB9;&#x89C2;&#x5BDF;&#x5230;&#x7684;&#x6A21;&#x5757;&#xFF0C;&#x5B83;&#x4EEC;&#x4F1A;&#x50CF;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-js">(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">root, factory</span>) </span>{
    <span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> define === <span class="hljs-string">&quot;function&quot;</span> &amp;&amp; define.amd) {
        define([<span class="hljs-string">&quot;libName&quot;</span>], factory);
    } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> <span class="hljs-built_in">module</span> === <span class="hljs-string">&quot;object&quot;</span> &amp;&amp; <span class="hljs-built_in">module</span>.exports) {
        <span class="hljs-built_in">module</span>.exports = factory(<span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;libName&quot;</span>));
    } <span class="hljs-keyword">else</span> {
        root.returnExports = factory(root.libName);
    }
}(<span class="hljs-keyword">this</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">b</span>) </span>{
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x5728;&#x5E93;&#x7684;&#x6E90;&#x7801;&#x91CC;&#x770B;&#x5230;&#x4E86;<code>typeof define</code>&#xFF0C;<code>typeof window</code>&#xFF0C;&#x6216;<code>typeof module</code>&#x8FD9;&#x6837;&#x7684;&#x6D4B;&#x8BD5;&#xFF0C;&#x5C24;&#x5176;&#x662F;&#x5728;&#x6587;&#x4EF6;&#x7684;&#x9876;&#x7AEF;&#xFF0C;&#x90A3;&#x4E48;&#x5B83;&#x51E0;&#x4E4E;&#x5C31;&#x662F;&#x4E00;&#x4E2A;UMD&#x5E93;&#x3002;</p>
<p>UMD&#x5E93;&#x7684;&#x6587;&#x6863;&#x91CC;&#x7ECF;&#x5E38;&#x4F1A;&#x5305;&#x542B;&#x901A;&#x8FC7;<code>require</code>&#x201C;&#x5728;Node.js&#x91CC;&#x4F7F;&#x7528;&#x201D;&#x4F8B;&#x5B50;&#xFF0C;
  &#x548C;&#x201C;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x4F7F;&#x7528;&#x201D;&#x7684;&#x4F8B;&#x5B50;&#xFF0C;&#x5C55;&#x793A;&#x5982;&#x4F55;&#x4F7F;&#x7528;<code>&lt;script&gt;</code>&#x6807;&#x7B7E;&#x53BB;&#x52A0;&#x8F7D;&#x811A;&#x672C;&#x3002;</p>
<h3 id="umd&#x5E93;&#x7684;&#x4F8B;&#x5B50;">UMD&#x5E93;&#x7684;&#x4F8B;&#x5B50;</h3>
<p>&#x5927;&#x591A;&#x6570;&#x6D41;&#x884C;&#x7684;&#x5E93;&#x73B0;&#x5728;&#x90FD;&#x80FD;&#x591F;&#x88AB;&#x5F53;&#x6210;UMD&#x5305;&#x3002;
&#x6BD4;&#x5982;<a href="https://jquery.com/" target="_blank">jQuery</a>,<a href="http://momentjs.com/" target="_blank">Moment.js</a>,<a href="https://lodash.com/" target="_blank">lodash</a>&#x548C;&#x8BB8;&#x591A;&#x5176;&#x5B83;&#x7684;&#x3002;</p>
<h3 id="&#x6A21;&#x7248;">&#x6A21;&#x7248;</h3>
<p>&#x9488;&#x5BF9;&#x6A21;&#x5757;&#x6709;&#x4E09;&#x79CD;&#x53EF;&#x7528;&#x7684;&#x6A21;&#x5757;&#xFF0C;
  <a href="templates/module.d.ts.md"><code>module.d.ts</code></a>, <a href="templates/module-class.d.ts.md"><code>module-class.d.ts</code></a> and <a href="templates/module-function.d.ts.md"><code>module-function.d.ts</code></a>.</p>
<p>&#x4F7F;&#x7528;<a href="templates/module-function.d.ts.md"><code>module-function.d.ts</code></a>&#xFF0C;&#x5982;&#x679C;&#x6A21;&#x5757;&#x80FD;&#x591F;&#x4F5C;&#x4E3A;&#x51FD;&#x6570;<em>&#x8C03;&#x7528;</em>&#x3002;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> x = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;foo&quot;</span>);
<span class="hljs-comment">// Note: calling &apos;x&apos; as a function</span>
<span class="hljs-keyword">var</span> y = x(<span class="hljs-number">42</span>);
</code></pre>
<p>&#x4E00;&#x5B9A;&#x8981;&#x9605;&#x8BFB;<a href="#the-impact-of-es6-on-module-call-signatures">&#x8865;&#x5145;&#x8BF4;&#x660E;&#xFF1A; &#x201C;ES6&#x6A21;&#x5757;&#x8C03;&#x7528;&#x7B7E;&#x540D;&#x7684;&#x5F71;&#x54CD;&#x201D;</a></p>
<p>&#x4F7F;&#x7528;<a href="templates/module-class.d.ts.md"><code>module-class.d.ts</code></a>&#x5982;&#x679C;&#x6A21;&#x5757;&#x80FD;&#x591F;&#x4F7F;&#x7528;<code>new</code>&#x6765;<em>&#x6784;&#x9020;</em>&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> x = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;bar&quot;</span>);
<span class="hljs-comment">// Note: using &apos;new&apos; operator on the imported variable</span>
<span class="hljs-keyword">var</span> y = <span class="hljs-keyword">new</span> x(<span class="hljs-string">&quot;hello&quot;</span>);
</code></pre>
<p>&#x76F8;&#x540C;&#x7684;<a href="#the-impact-of-es6-on-module-plugins">&#x8865;&#x5145;&#x8BF4;&#x660E;</a>&#x4F5C;&#x7528;&#x4E8E;&#x8FD9;&#x4E9B;&#x6A21;&#x5757;&#x3002;</p>
<p>&#x5982;&#x679C;&#x6A21;&#x5757;&#x4E0D;&#x80FD;&#x88AB;&#x8C03;&#x7528;&#x6216;&#x6784;&#x9020;&#xFF0C;&#x4F7F;&#x7528;<a href="templates/module.d.ts.md"><code>module.d.ts</code></a>&#x6587;&#x4EF6;&#x3002;</p>
<h2 id="&#x6A21;&#x5757;&#x63D2;&#x4EF6;&#x6216;umd&#x63D2;&#x4EF6;"><em>&#x6A21;&#x5757;&#x63D2;&#x4EF6;</em>&#x6216;<em>UMD&#x63D2;&#x4EF6;</em></h2>
<p>&#x4E00;&#x4E2A;<em>&#x6A21;&#x5757;&#x63D2;&#x4EF6;</em>&#x53EF;&#x4EE5;&#x6539;&#x53D8;&#x4E00;&#x4E2A;&#x6A21;&#x5757;&#x7684;&#x7ED3;&#x6784;&#xFF08;UMD&#x6216;&#x6A21;&#x5757;&#xFF09;&#x3002;
&#x4F8B;&#x5982;&#xFF0C;&#x5728;Moment.js&#x91CC;&#xFF0C;<code>moment-range</code>&#x6DFB;&#x52A0;&#x4E86;&#x65B0;&#x7684;<code>range</code>&#x65B9;&#x6CD5;&#x5230;<code>monent</code>&#x5BF9;&#x8C61;&#x3002;</p>
<p>&#x5BF9;&#x4E8E;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x7684;&#x76EE;&#x6807;&#xFF0C;&#x6211;&#x4EEC;&#x4F1A;&#x5199;&#x76F8;&#x540C;&#x7684;&#x4EE3;&#x7801;&#x4E0D;&#x8BBA;&#x88AB;&#x6539;&#x53D8;&#x7684;&#x6A21;&#x5757;&#x662F;&#x4E00;&#x4E2A;&#x7EAF;&#x7CB9;&#x7684;&#x6A21;&#x5757;&#x8FD8;&#x662F;UMD&#x6A21;&#x5757;&#x3002;</p>
<h3 id="&#x6A21;&#x7248;">&#x6A21;&#x7248;</h3>
<p>&#x4F7F;&#x7528;<a href="templates/module-plugin.d.ts.md"><code>module-plugin.d.ts</code></a>&#x6A21;&#x7248;&#x3002;</p>
<h2 id="&#x5168;&#x5C40;&#x63D2;&#x4EF6;"><em>&#x5168;&#x5C40;&#x63D2;&#x4EF6;</em></h2>
<p>&#x4E00;&#x4E2A;<em>&#x5168;&#x5C40;&#x63D2;&#x4EF6;</em>&#x662F;&#x5168;&#x5C40;&#x4EE3;&#x7801;&#xFF0C;&#x5B83;&#x4EEC;&#x4F1A;&#x6539;&#x53D8;&#x5168;&#x5C40;&#x5BF9;&#x8C61;&#x7684;&#x7ED3;&#x6784;&#x3002;
&#x5BF9;&#x4E8E;<em>&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;</em>&#xFF0C;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x5B58;&#x5728;&#x51B2;&#x7A81;&#x7684;&#x53EF;&#x80FD;&#x3002;</p>
<p>&#x6BD4;&#x5982;&#xFF0C;&#x4E00;&#x4E9B;&#x5E93;&#x5F80;<code>Array.prototype</code>&#x6216;<code>String.prototype</code>&#x91CC;&#x6DFB;&#x52A0;&#x65B0;&#x7684;&#x65B9;&#x6CD5;&#x3002;</p>
<h3 id="&#x8BC6;&#x522B;&#x5168;&#x5C40;&#x63D2;&#x4EF6;">&#x8BC6;&#x522B;&#x5168;&#x5C40;&#x63D2;&#x4EF6;</h3>
<p>&#x5168;&#x5C40;&#x901A;&#x5E38;&#x5F88;&#x5BB9;&#x6613;&#x5730;&#x4ECE;&#x5B83;&#x4EEC;&#x7684;&#x6587;&#x6863;&#x8BC6;&#x522B;&#x51FA;&#x6765;&#x3002;</p>
<p>&#x4F60;&#x4F1A;&#x770B;&#x5230;&#x50CF;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">var</span> x = <span class="hljs-string">&quot;hello, world&quot;</span>;
<span class="hljs-comment">// Creates new methods on built-in types</span>
<span class="hljs-built_in">console</span>.log(x.startsWithHello());

<span class="hljs-keyword">var</span> y = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>];
<span class="hljs-comment">// Creates new methods on built-in types</span>
<span class="hljs-built_in">console</span>.log(y.reverseAndSort());
</code></pre>
<h3 id="&#x6A21;&#x7248;">&#x6A21;&#x7248;</h3>
<p>&#x4F7F;&#x7528;<a href="templates/global-plugin.d.ts.md"><code>global-plugin.d.ts</code></a>&#x6A21;&#x7248;&#x3002;</p>
<h2 id="&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;"><em>&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;</em></h2>
<p>&#x5F53;&#x4E00;&#x4E2A;<em>&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;</em>&#x88AB;&#x5BFC;&#x5165;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5B83;&#x4EEC;&#x4F1A;&#x6539;&#x53D8;&#x5168;&#x5C40;&#x4F5C;&#x7528;&#x57DF;&#x91CC;&#x7684;&#x503C;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x5B58;&#x5728;&#x4E00;&#x4E9B;&#x5E93;&#x5B83;&#x4EEC;&#x6DFB;&#x52A0;&#x65B0;&#x7684;&#x6210;&#x5458;&#x5230;<code>String.prototype</code>&#x5F53;&#x5BFC;&#x5165;&#x5B83;&#x4EEC;&#x7684;&#x65F6;&#x5019;&#x3002;
&#x8FD9;&#x79CD;&#x6A21;&#x5F0F;&#x5F88;&#x5371;&#x9669;&#xFF0C;&#x56E0;&#x4E3A;&#x53EF;&#x80FD;&#x9020;&#x6210;&#x8FD0;&#x884C;&#x65F6;&#x7684;&#x51B2;&#x7A81;&#xFF0C;
  &#x4F46;&#x662F;&#x6211;&#x4EEC;&#x4ECD;&#x7136;&#x53EF;&#x4EE5;&#x4E3A;&#x5B83;&#x4EEC;&#x4E66;&#x5199;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x3002;</p>
<h3 id="&#x8BC6;&#x522B;&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;">&#x8BC6;&#x522B;&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;</h3>
<p>&#x5168;&#x5C40;&#x4FEE;&#x6539;&#x7684;&#x6A21;&#x5757;&#x901A;&#x5E38;&#x53EF;&#x4EE5;&#x5F88;&#x5BB9;&#x6613;&#x5730;&#x4ECE;&#x5B83;&#x4EEC;&#x7684;&#x6587;&#x6863;&#x8BC6;&#x522B;&#x51FA;&#x6765;&#x3002;
&#x901A;&#x5E38;&#x6765;&#x8BB2;&#xFF0C;&#x5B83;&#x4EEC;&#x4E0E;&#x5168;&#x5C40;&#x63D2;&#x4EF6;&#x76F8;&#x4F3C;&#xFF0C;&#x4F46;&#x662F;&#x9700;&#x8981;<code>require</code>&#x8C03;&#x7528;&#x6765;&#x6FC0;&#x6D3B;&#x5B83;&#x4EEC;&#x7684;&#x6548;&#x679C;&#x3002;</p>
<p>&#x4F60;&#x53EF;&#x80FD;&#x4F1A;&#x770B;&#x5230;&#x50CF;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#x7684;&#x6587;&#x6863;:</p>
<pre><code class="lang-ts"><span class="hljs-comment">// &apos;require&apos; call that doesn&apos;t use its return value</span>
<span class="hljs-keyword">var</span> unused = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;magic-string-time&quot;</span>);
<span class="hljs-comment">/* or */</span>
<span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;magic-string-time&quot;</span>);

<span class="hljs-keyword">var</span> x = <span class="hljs-string">&quot;hello, world&quot;</span>;
<span class="hljs-comment">// Creates new methods on built-in types</span>
<span class="hljs-built_in">console</span>.log(x.startsWithHello());

<span class="hljs-keyword">var</span> y = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>];
<span class="hljs-comment">// Creates new methods on built-in types</span>
<span class="hljs-built_in">console</span>.log(y.reverseAndSort());
</code></pre>
<h3 id="&#x6A21;&#x7248;">&#x6A21;&#x7248;</h3>
<p>&#x4F7F;&#x7528;<a href="templates/global-modifying-module.d.ts.md"><code>global-modifying-module.d.ts</code></a>&#x6A21;&#x7248;&#x3002;</p>
<h1 id="&#x4F7F;&#x7528;&#x4F9D;&#x8D56;"><a name="consuming-dependencies"></a>&#x4F7F;&#x7528;&#x4F9D;&#x8D56;</h1>
<p>&#x53EF;&#x80FD;&#x4F1A;&#x6709;&#x4EE5;&#x4E0B;&#x51E0;&#x79CD;&#x4F9D;&#x8D56;&#x3002;</p>
<h2 id="&#x4F9D;&#x8D56;&#x5168;&#x5C40;&#x5E93;">&#x4F9D;&#x8D56;&#x5168;&#x5C40;&#x5E93;</h2>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x5E93;&#x4F9D;&#x8D56;&#x4E8E;&#x67D0;&#x4E2A;&#x5168;&#x5C40;&#x5E93;&#xFF0C;&#x4F7F;&#x7528;<code>/// &lt;reference types=&quot;...&quot; /&gt;</code>&#x6307;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-comment">/// &lt;reference types=&quot;someLib&quot; /&gt;</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getThing</span>(<span class="hljs-params"></span>): <span class="hljs-title">someLib</span>.<span class="hljs-title">thing</span></span>;
</code></pre>
<h2 id="&#x4F9D;&#x8D56;&#x6A21;&#x5757;">&#x4F9D;&#x8D56;&#x6A21;&#x5757;</h2>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x5E93;&#x4F9D;&#x8D56;&#x4E8E;&#x6A21;&#x5757;&#xFF0C;&#x4F7F;&#x7528;<code>import</code>&#x8BED;&#x53E5;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> * as moment from <span class="hljs-string">&quot;moment&quot;</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getThing</span>(<span class="hljs-params"></span>): <span class="hljs-title">moment</span></span>;
</code></pre>
<h2 id="&#x4F9D;&#x8D56;umd&#x5E93;">&#x4F9D;&#x8D56;UMD&#x5E93;</h2>
<h3 id="&#x4ECE;&#x5168;&#x5C40;&#x5E93;">&#x4ECE;&#x5168;&#x5C40;&#x5E93;</h3>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x5168;&#x5C40;&#x5E93;&#x4F9D;&#x8D56;&#x4E8E;&#x67D0;&#x4E2A;UMD&#x6A21;&#x5757;&#xFF0C;&#x4F7F;&#x7528;<code>/// &lt;reference types</code>&#x6307;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-comment">/// &lt;reference types=&quot;moment&quot; /&gt;</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getThing</span>(<span class="hljs-params"></span>): <span class="hljs-title">moment</span></span>;
</code></pre>
<h3 id="&#x4ECE;&#x4E00;&#x4E2A;&#x6A21;&#x5757;&#x6216;umd&#x5E93;">&#x4ECE;&#x4E00;&#x4E2A;&#x6A21;&#x5757;&#x6216;UMD&#x5E93;</h3>
<p>&#x5982;&#x679C;&#x4F60;&#x7684;&#x6A21;&#x5757;&#x6216;UMD&#x5E93;&#x4F9D;&#x8D56;&#x4E8E;&#x4E00;&#x4E2A;UMD&#x5E93;&#xFF0C;&#x4F7F;&#x7528;<code>import</code>&#x8BED;&#x53E5;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> * as someLib from <span class="hljs-string">&apos;someLib&apos;</span>;
</code></pre>
<p><em>&#x4E0D;&#x8981;</em>&#x4F7F;&#x7528;<code>/// &lt;reference</code>&#x6307;&#x4EE4;&#x53BB;&#x58F0;&#x660E;UMD&#x5E93;&#x7684;&#x4F9D;&#x8D56;&#xFF01;</p>
<h1 id="&#x8865;&#x5145;&#x8BF4;&#x660E;">&#x8865;&#x5145;&#x8BF4;&#x660E;</h1>
<h2 id="&#x9632;&#x6B62;&#x547D;&#x540D;&#x51B2;&#x7A81;"><a name="preventing-name-conflicts"></a>&#x9632;&#x6B62;&#x547D;&#x540D;&#x51B2;&#x7A81;</h2>
<p>&#x6CE8;&#x610F;&#xFF0C;&#x5728;&#x4E66;&#x5199;&#x5168;&#x5C40;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5141;&#x8BB8;&#x5728;&#x5168;&#x5C40;&#x4F5C;&#x7528;&#x57DF;&#x91CC;&#x5B9A;&#x4E49;&#x5F88;&#x591A;&#x7C7B;&#x578B;&#x3002;
&#x6211;&#x4EEC;&#x5341;&#x5206;&#x4E0D;&#x5EFA;&#x4E49;&#x8FD9;&#x6837;&#x505A;&#xFF0C;&#x5F53;&#x4E00;&#x4E2A;&#x5DE5;&#x7A0B;&#x91CC;&#x6709;&#x8BB8;&#x591A;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x65F6;&#xFF0C;&#x5B83;&#x4F1A;&#x5BFC;&#x81F4;&#x65E0;&#x6CD5;&#x5904;&#x7406;&#x7684;&#x547D;&#x540D;&#x51B2;&#x7A81;&#x3002;</p>
<p>&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x89C4;&#x5219;&#x662F;&#x4F7F;&#x7528;&#x5E93;&#x5B9A;&#x4E49;&#x7684;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#x540D;&#x6765;&#x58F0;&#x660E;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x7C7B;&#x578B;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x5E93;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x5168;&#x5C40;&#x7684;&#x503C;<code>cats</code>&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x8FD9;&#x6837;&#x5199;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">declare</span> <span class="hljs-keyword">namespace</span> cats {
    <span class="hljs-keyword">interface</span> KittySettings { }
}
</code></pre>
<p><em>&#x4E0D;&#x8981;</em></p>
<pre><code class="lang-ts"><span class="hljs-comment">// at top-level</span>
<span class="hljs-keyword">interface</span> CatsKittySettings { }
</code></pre>
<p>&#x8FD9;&#x6837;&#x4E5F;&#x4FDD;&#x8BC1;&#x4E86;&#x5E93;&#x5728;&#x8F6C;&#x6362;&#x6210;UMD&#x7684;&#x65F6;&#x5019;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x7684;&#x7834;&#x574F;&#x5F0F;&#x6539;&#x53D8;&#xFF0C;&#x5BF9;&#x4E8E;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x7528;&#x6237;&#x6765;&#x8BF4;&#x3002;</p>
<h2 id="es6&#x6A21;&#x5757;&#x63D2;&#x4EF6;&#x7684;&#x5F71;&#x54CD;"><a name="the-impact-of-es6-on-module-plugins"></a>ES6&#x6A21;&#x5757;&#x63D2;&#x4EF6;&#x7684;&#x5F71;&#x54CD;</h2>
<p>&#x4E00;&#x4E9B;&#x63D2;&#x4EF6;&#x6DFB;&#x52A0;&#x6216;&#x4FEE;&#x6539;&#x5DF2;&#x5B58;&#x5728;&#x7684;&#x9876;&#x5C42;&#x6A21;&#x5757;&#x7684;&#x5BFC;&#x51FA;&#x90E8;&#x5206;&#x3002;
&#x5F53;&#x7136;&#x8FD9;&#x5728;CommonJS&#x548C;&#x5176;&#x5B83;&#x52A0;&#x8F7D;&#x5668;&#x91CC;&#x662F;&#x5141;&#x8BB8;&#x7684;&#xFF0C;ES&#x6A21;&#x5757;&#x88AB;&#x5F53;&#x4F5C;&#x662F;&#x4E0D;&#x53EF;&#x6539;&#x53D8;&#x7684;&#x56E0;&#x6B64;&#x8FD9;&#x79CD;&#x6A21;&#x5F0F;&#x5C31;&#x4E0D;&#x53EF;&#x884C;&#x4E86;&#x3002;
&#x56E0;&#x4E3A;TypeScript&#x662F;&#x80FD;&#x4E0D;&#x9884;&#x77E5;&#x52A0;&#x8F7D;&#x5668;&#x7C7B;&#x578B;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x6CA1;&#x6CA1;&#x5728;&#x7F16;&#x8BD1;&#x65F6;&#x4FDD;&#x8BC1;&#xFF0C;&#x4F46;&#x662F;&#x5F00;&#x53D1;&#x8005;&#x5982;&#x679C;&#x8981;&#x8F6C;&#x5230;ES6&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#x4E0A;&#x5E94;&#x8BE5;&#x6CE8;&#x610F;&#x8FD9;&#x4E00;&#x70B9;&#x3002;</p>
<h2 id="es6&#x6A21;&#x5757;&#x8C03;&#x7528;&#x7B7E;&#x540D;&#x7684;&#x5F71;&#x54CD;"><a name="the-impact-of-es6-on-module-call-signatures"></a>ES6&#x6A21;&#x5757;&#x8C03;&#x7528;&#x7B7E;&#x540D;&#x7684;&#x5F71;&#x54CD;</h2>
<p>&#x5F88;&#x591A;&#x6D41;&#x884C;&#x5E93;&#xFF0C;&#x6BD4;&#x5982;Express&#xFF0C;&#x66B4;&#x9732;&#x51FA;&#x81EA;&#x5DF1;&#x4F5C;&#x4E3A;&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x7684;&#x51FD;&#x6570;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x5178;&#x578B;&#x7684;Express&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> exp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;express&quot;</span>);
<span class="hljs-keyword">var</span> app = exp();
</code></pre>
<p>&#x5728;ES6&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#x91CC;&#xFF0C;&#x9876;&#x5C42;&#x7684;&#x5BF9;&#x8C61;&#xFF08;&#x8FD9;&#x91CC;&#x4EE5;<code>exp</code>&#x5BFC;&#x5165;&#xFF09;&#x53EA;&#x80FD;&#x5177;&#x6709;&#x5C5E;&#x6027;&#xFF1B;
  &#x9876;&#x5C42;&#x7684;&#x6A21;&#x5757;&#x5BF9;&#x8C61;<em>&#x6C38;&#x8FDC;&#x4E0D;&#x80FD;</em>&#x88AB;&#x8C03;&#x7528;&#x3002;
&#x5341;&#x5206;&#x5E38;&#x89C1;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#x662F;&#x5B9A;&#x4E49;&#x4E00;&#x4E2A;<code>default</code>&#x5BFC;&#x51FA;&#x5230;&#x4E00;&#x4E2A;&#x53EF;&#x8C03;&#x7528;&#x7684;/&#x53EF;&#x6784;&#x9020;&#x7684;&#x5BF9;&#x8C61;&#xFF1B;
  &#x4E00;&#x4F1A;&#x6A21;&#x5757;&#x52A0;&#x8F7D;&#x5668;&#x52A9;&#x624B;&#x5DE5;&#x5177;&#x80FD;&#x591F;&#x81EA;&#x5DF1;&#x63A2;&#x6D4B;&#x5230;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x5E76;&#x4E14;&#x4F7F;&#x7528;<code>default</code>&#x5BFC;&#x51FA;&#x6765;&#x66FF;&#x6362;&#x9876;&#x5C42;&#x5BF9;&#x8C61;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Introduction.html" class="navigation navigation-prev " aria-label="Previous page: 如何书写声明文件">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Do's and Don'ts.html" class="navigation navigation-next " aria-label="Next page: 规范">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"结构","level":"1.4.1","depth":2,"next":{"title":"规范","level":"1.4.2","depth":2,"path":"doc/handbook/declaration files/Do's and Don'ts.md","ref":"./doc/handbook/declaration files/Do's and Don'ts.md","articles":[]},"previous":{"title":"如何书写声明文件","level":"1.4","depth":1,"path":"doc/handbook/declaration files/Introduction.md","ref":"./doc/handbook/declaration files/Introduction.md","articles":[{"title":"结构","level":"1.4.1","depth":2,"path":"doc/handbook/declaration files/Library Structures.md","ref":"./doc/handbook/declaration files/Library Structures.md","articles":[]},{"title":"规范","level":"1.4.2","depth":2,"path":"doc/handbook/declaration files/Do's and Don'ts.md","ref":"./doc/handbook/declaration files/Do's and Don'ts.md","articles":[]},{"title":"举例","level":"1.4.3","depth":2,"path":"doc/handbook/declaration files/By Example.md","ref":"./doc/handbook/declaration files/By Example.md","articles":[]},{"title":"深入","level":"1.4.4","depth":2,"path":"doc/handbook/declaration files/Deep Dive.md","ref":"./doc/handbook/declaration files/Deep Dive.md","articles":[]},{"title":"发布","level":"1.4.5","depth":2,"path":"doc/handbook/declaration files/Publishing.md","ref":"./doc/handbook/declaration files/Publishing.md","articles":[]},{"title":"使用","level":"1.4.6","depth":2,"path":"doc/handbook/declaration files/Consumption.md","ref":"./doc/handbook/declaration files/Consumption.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/handbook/declaration files/Library Structures.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

